home *** CD-ROM | disk | FTP | other *** search
/ NeXTSTEP 3.3 (Developer)…68k, x86, SPARC, PA-RISC] / NeXTSTEP 3.3 Dev Intel.iso / NextDeveloper / Headers / g++ / minmax.h < prev    next >
C/C++ Source or Header  |  1995-02-06  |  2KB  |  67 lines

  1. /*
  2. Copyright (C) 1992 Free Software Foundation
  3.     written by Doug Lea (dl@rocky.oswego.edu)
  4.  
  5. This file is part of the GNU C++ Library.  This library is free
  6. software; you can redistribute it and/or modify it under the terms of
  7. the GNU Library General Public License as published by the Free
  8. Software Foundation; either version 2 of the License, or (at your
  9. option) any later version.  This library is distributed in the hope
  10. that it will be useful, but WITHOUT ANY WARRANTY; without even the
  11. implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  12. PURPOSE.  See the GNU Library General Public License for more details.
  13. You should have received a copy of the GNU Library General Public
  14. License along with this library; if not, write to the Free Software
  15. Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  16. */
  17.  
  18. #ifndef _minmax_h
  19. #ifdef _GNUG_
  20. #pragma interface
  21. #pragma cplusplus
  22. #endif
  23. #define _minmax_h 1
  24.  
  25. #include <_G_config.h>
  26.  
  27. inline char min(char a, char b) { return (a < b)?a:b;}
  28. #ifndef  _G_BROKEN_SIGNED_CHAR
  29. inline signed char min(signed char a, signed char b) { return (a < b)?a:b;}
  30. #endif
  31. inline unsigned char min(unsigned char a, unsigned char b) {return (a<b)?a:b;}
  32.  
  33. inline short min(short a, short b) {return (a < b) ?a:b;}
  34. inline unsigned short min(unsigned short a, unsigned short b) {return (a < b)?a:b;}
  35.  
  36. inline int min(int a, int b) {return (a < b)?a:b;}
  37. inline unsigned int min(unsigned int a, unsigned int b) {return (a < b)?a:b;}
  38.  
  39. inline long min(long a, long b) {return (a < b)?a:b;}
  40. inline unsigned long min(unsigned long a, unsigned long b) {return (a<b)?a:b;}
  41.  
  42. inline float min(float a, float b) {return (a < b)?a:b;}
  43.  
  44. inline double min(double a, double b) {return (a < b)?a:b;}
  45.  
  46. inline char max(char a, char b) { return (a > b)?a:b;}
  47. #ifndef  _G_BROKEN_SIGNED_CHAR
  48. inline signed char max(signed char a, signed char b) {return (a > b)?a:b;}
  49. #endif
  50. inline unsigned char max(unsigned char a, unsigned char b) {return (a>b)?a:b;}
  51.  
  52. inline short max(short a, short b) {return (a > b) ?a:b;}
  53. inline unsigned short max(unsigned short a, unsigned short b) {return (a > b)?a:b;}
  54.  
  55. inline int max(int a, int b) {return (a > b)?a:b;}
  56. inline unsigned int max(unsigned int a, unsigned int b) {return (a > b)?a:b;}
  57.  
  58. inline long max(long a, long b) {return (a > b)?a:b;}
  59. inline unsigned long max(unsigned long a, unsigned long b) {return (a>b)?a:b;}
  60.  
  61. inline float max(float a, float b) {return (a > b)?a:b;}
  62.  
  63. inline double max(double a, double b) {return (a > b)?a:b;}
  64.  
  65. #endif
  66.  
  67.